package com.ruoyi.system.api;

import com.ruoyi.common.core.constant.SecurityConstants;
import com.ruoyi.common.core.constant.ServiceNameConstants;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.factory.RemoteWeixinFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = ServiceNameConstants.WEIXIN_SERVICE, contextId = "remoteWeixinService",
        value = ServiceNameConstants.WEIXIN_SERVICE, fallbackFactory = RemoteWeixinFallbackFactory.class)
public interface RemoteWeixinService {
    /**
     * 发送微信客服消息
     * @param toUser
     * @param content
     * @return
     */
    // SecurityConstants.INNER  我使用了内部调用接口 所以不需要网关路由那一段url
    @PostMapping("/wx/wxMpKefuMessage")
    public AjaxResult wxMpKefuMessage(@RequestParam("toUser") String toUser,
                                 @RequestParam("content") String content,
                                 @RequestHeader(SecurityConstants.FROM_SOURCE) String source
    );

}
